import sys
from dingtalkchatbot.chatbot import DingtalkChatbot
from dingtalkchatbot.chatbot import CardItem
from dingtalkchatbot.chatbot import ActionCard
# WebHook地址
#webhook = 'https://oapi.dingtalk.com/robot/send?access_token=02fd5264b64d3907ec768ad1b133f739cb5720e7e90148d4e6ca37cf34a83a94'
#xiaoding = DingtalkChatbot(webhook) 

# ActionCard独立跳转消息类型
# macdown   支持@对应人+跳转所以选择macdown发送
change = sys.argv[1]
theme = sys.argv[2]
project = sys.argv[3]
bindip = sys.argv[4]
value = sys.argv[5]
webhook = sys.argv[6]
Mobiles = sys.argv[7]
xiaoding = DingtalkChatbot(webhook)

#at_mobiles=[Mobiles]
xiaoding.send_markdown(title='wethink', text=change+'\n'
                       '> ###  [屏蔽该告警](http://ip:port/alarm/process/'+theme+','+bindip+',0)'+'\n\n'
                       '> ###  [恢复该告警](http://p:port/alarm/process/'+theme+','+bindip+',1)'+'\n\n'
                       '> ####  主题:'+theme+'\n\n'
                       '> ####  项目:'+project+'\n\n'
		               '> ####  服务器名ip:'+bindip+'\n\n'
                       '> 线程名称:'+value+'\n',
                       at_mobiles=[Mobiles])

